using UnityEngine;
using System.Collections;

public class Move : MonoBehaviour {
	public bool backForth = true;
	public float bucket = 0;
	public float fill = 40;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		
	if(backForth)
		{
	transform.position+=transform.forward*20*Time.deltaTime;
			bucket+=20*Time.deltaTime;
			if(bucket>fill)
			{
				backForth = false;
				
			}
		}
		else{
			transform.position-=transform.forward*20*Time.deltaTime;
			bucket-=20*Time.deltaTime;
			if(bucket<0)
			{
				backForth = true;
				
			}
			
		}
		
	}
}
